/**
 * 商品详情 - 编辑页面
 * @author yaohuan
 * @date 2018/02/27
 */
define(function () {

    var self,
        app = win.app,
        doc = document,
        fileList = [],
        vueData = {
            form: {
                GWAM001: null,
                GWDB016: null,
                GWAM016: null,
                GWAM017: null,
                GWDC001: null,
                GWAM008: null,
                GWAM015: null,
                GWCQ001: null,
                GWCQ002: null,
                GWCQ003: null,
                GWCQ004: null,
                GWCQ005: null,
                GWCQ010: null,
                GWCQ109: null,
                GWCQ110: null,
                GWCQ111: null,
                GWCQ113: null,
                GWCQ114: null,
                GWAK061: null,
                GWDC005: null,
                GWDC004: null,
                num: null,
                GWCQ115: null,
                GWAM004_NAME: null,
                GWAM007_NAME: null,
                url:''
            },
            imgList: [],
            list: [],
            gwanList: [],
            gwamList: []
        },
        callObj
    ;

    var goodsInfo = app.Module.extend({
        init: function () {
            self = this;
            self._super({
                _tag: 'goods-info'
            }, win);

        },

        _call: function (obj) {
            vueData.gwanList = [];
            vueData.gwamList = [];
            vueData.imgList = [];
            vueData.list = [];
            callObj = obj; app.extendUpLow({
                target: vueData.form,
                res: callObj,
                reset: true
            });
            var list2 = obj.GWAM015.split(',');
            for (var i = 0; i < list2.length; i++) {
                vueData.imgList.push('/wissun-smfile/' + list2[i]);
            }
            vueData.form.GWAK061 = obj.GWAK061;
            vueData.form.GWDC001 = obj.GWDC001;
            vueData.form.GWAM007_NAME = obj.GWAM007_NAME;
            vueData.form.GWAM004_NAME = obj.GWAM004_NAME;
            vueData.list.push(obj.GWAM007_NAME);
            vueData.list.push(obj.GWAM004_NAME);
            vueData.list.push(obj.GWAM001);
            vueData.list.push(obj.GWAML004);
            vueData
            vueData.form.GWAK001 = obj.GWAK001;
            app.ajax({
                xurl: 'admin/getGwan',
                xdata: {
                    GWAN001: obj.GWAM001
                },
                async: false,
                cb: function (result) {
                    if (result.ok) {
                        vueData.gwanList = result.data.data;
                    }
                }
            });
            vueData.form.GWCQ002 = obj.GWAM008;
            vueData.form.GWCQ003 = obj.GWDC020;
            vueData.form.GWCQ004 = obj.GWDB016;
            vueData.form.GWCQ113 = obj.GWDC023;
            vueData.form.num = obj.GWDC020;

            if (vueData.gwanList.length > 0) {
                app.ajax({
                    xurl: 'admin/getGwamDetail',
                    xdata: {
                        GWAM001: obj.GWAM001,
                        GWDB012: obj.GWAK001,
                        GWDC001: obj.GWDC001,
                        GWAK061: obj.GWAK061,
                        GWAK010: obj.GWAK010
                    },
                    async: false,
                    cb: function (result) {
                        if (result.ok) {
                            vueData.gwamList = result.data.data;
                            var gwamlist = result.data.data;
                            if (gwamlist.length > 0) {
                                vueData.form.GWAM001 = gwamlist[0].GWAM001;
                                vueData.list.push(gwamlist[0].GWAM001);
                                vueData.list.push(gwamlist[0].GWAML004);
                                // vueData.form.GWAM015 = gwamlist[0].GWAM015;
                                vueData.form.GWAM016 = gwamlist[0].GWAM016;
                                vueData.form.GWAM017 = gwamlist[0].GWAM017;
                                vueData.form.GWCQ004 = gwamlist[0].GWDB016;
                                vueData.form.GWCQ002 = gwamlist[0].GWAM008;
                                vueData.form.GWCQ003 = gwamlist[0].GWDC020;
                                vueData.form.GWCQ113 = gwamlist[0].GWDC023;
                                vueData.form.num = gwamlist[0].GWDC020;
                                gwamlist[0].child.forEach(function (t) {
                                    vueData.gwanList.forEach(function (v) {
                                        if (v.GWAN002 == t.GWAN002) {
                                            v.list.forEach(function (index) {
                                                if (index.GWAJ002 == t.GWAN003) {
                                                    index.status = true;
                                                } else {
                                                    index.status = false;
                                                }
                                            });
                                        }
                                    })
                                })
                            }
                        }
                    }
                });
            }
            vueData.form.GWDC005 = obj.GWDC005;
            vueData.form.GWDC004 = obj.GWDC004;
            vueData.form.GWCQ115 = obj.GWAK061;
            if (obj.GWDC001 != '' && obj.GWDC001 != null) {
                if (obj.GWDC005 == '1' && (obj.GWDC006 == '1' || obj.GWDC006 == '2')) {
                    vueData.form.GWCQ114 = '2';
                } else if (obj.GWDC005 == '1' && obj.GWDC006 == '3') {
                    vueData.form.GWCQ114 = '4';
                } else if (obj.GWDC005 != '1' && (obj.GWDC006 == '1' || obj.GWDC006 == '2')) {
                    vueData.form.GWCQ114 = '1';
                } else if (obj.GWDC005 != '1' && obj.GWDC006 == '3') {
                    vueData.form.GWCQ114 = '3';
                }
            } else {
                vueData.form.GWCQ114 = '1';
            }
        },
        _ready: function () {
            var vue = new Vue({
                el: '#goods-info',
                data: vueData,
                methods: {
                    gwanChange: function (data,val) {
                        data.list.forEach(function (t) {
                            if(t.GWAJ002==val.GWAJ002){
                                $("#"+val.GWAJ002).addClass("choose")
                            }else {
                                $("#"+t.GWAJ002).removeClass("choose")
                            }
                        })
                        data.GWAJ002 = val.GWAJ002
                        vueData.gwanList.forEach(function (item) {
                            item.list.forEach(function (index) {
                              if(index.GWAJ002 == data.GWAJ002){
                                  index.status = true;
                              }else{
                                  index.status = false;
                              }
                            })
                        });
                        vueData.gwanList.forEach(function (item) {
                            item.list.forEach(function (index) {
                                if(index.status == true){
                                    vueData.gwamList.forEach(function (i) {
                                        i.child.forEach(function (v) {
                                            if (v.GWAN003 == index.GWAJ002) {
                                                vueData.form.GWAM001 = i.GWAM001;
                                                // vueData.form.GWAM015 = i.GWAM015;
                                                vueData.form.GWAM016 = i.GWAM016;
                                                vueData.form.GWAM017 = i.GWAM017;
                                                vueData.form.GWCQ004 = i.GWDB016;
                                                vueData.form.GWCQ002 = i.GWAM008;
                                                vueData.form.GWCQ003 = i.GWDC020;
                                                vueData.form.GWCQ113 = i.GWDC023;
                                                vueData.form.num = i.GWDC020;
                                                vueData.list = [];
                                                vueData.list.push(vueData.form.GWAM007_NAME);
                                                vueData.list.push(vueData.form.GWAM004_NAME);
                                                vueData.list.push(i.GWAM001);
                                                vueData.list.push(i.GWAML004);
                                            }
                                        })
                                    });
                                }
                            })
                        })
                    },
                    handleChange: function (value) {
                        var date = new Date();
                        if (vueData.form.GWDC001 == null || vueData.form.GWDC001 == "") {
                            vueData.form.GWCQ003 = value;
                            vueData.form.GWCQ005 = math.mul(value, vueData.form.GWCQ004);
                        }
                        //组合+满额赠送
                        if (vueData.form.GWDC001 != null && vueData.form.GWDC004 == "1" && vueData.form.GWDC005 == "3") {
                            vueData.form.GWCQ003 = value;
                            vueData.form.GWCQ005 = math.mul(value, vueData.form.GWCQ004);
                        }
                        //组合+满量赠送
                        if (vueData.form.GWDC001 != null && vueData.form.GWDC004 == "1" && vueData.form.GWDC005 == "4") {
                            vueData.form.GWCQ003 = value;
                            vueData.form.GWCQ005 = math.mul(value, vueData.form.GWCQ004);
                        }
                        //非组合+满额赠送
                        if (vueData.form.GWDC001 != null && vueData.form.GWDC004 == "2" && vueData.form.GWDC005 == "3") {
                            vueData.form.GWCQ003 = value;
                            var _yData = {
                                GWCSDOCDATE: date.Format('yyyy-MM-dd'),
                                GWCS010: vueData.form.GWAK001,
                                GWCS001: vueData.form.GWAM001,
                                GWCS109: vueData.form.GWDC001,
                                GWCS003: value,
                                GWCS115: vueData.form.GWCQ113 //结算价
                            };
                            app.ajax({
                                xurl: 'admin/getPriceSingel',
                                xdata: _yData,
                                async: false,
                                cb: function (rtt) {
                                    if (rtt.ok) {
                                        if ((rtt.data.data.GWDC024 != null || rtt.data.data.GWDC024 != "") && rtt.data.data != "") {
                                            vueData.form.GWCQ004 = rtt.data.data.GWDC024;
                                            vueData.form.GWCQ005 = math.mul(value, vueData.form.GWCQ004);
                                        } else {
                                            vueData.form.GWCQ004 = vueData.form.GWCQ113;
                                            vueData.form.GWCQ005 = math.mul(value, vueData.form.GWCQ004);
                                        }
                                    }
                                }
                            });
                        }
                        //非组合+满量赠送
                        if (vueData.form.GWDC001 != null && vueData.form.GWDC004 == "2" && vueData.form.GWDC005 == "4") {
                            vueData.form.GWCQ003 = value;
                            var _yData = {
                                GWCSDOCDATE: date.Format('yyyy-MM-dd'),
                                GWCS010: vueData.form.GWAK001,
                                GWCS001: vueData.form.GWAM001,
                                GWCS109: vueData.form.GWDC001,
                                GWCS003: value
                            };
                            app.ajax({
                                xurl: 'admin/getPriceSingel',
                                xdata: _yData,
                                async: false,
                                cb: function (rtt) {
                                    if (rtt.ok) {
                                        if ((rtt.data.data.GWDC024 != null || rtt.data.data.GWDC024 != "") && rtt.data.data != "") {
                                            vueData.form.GWCQ004 = rtt.data.data.GWDC024;
                                            vueData.form.GWCQ005 = math.mul(value, vueData.form.GWCQ004);
                                        } else {
                                            vueData.form.GWCQ004 = vueData.form.GWCQ113;
                                            vueData.form.GWCQ005 = math.mul(value, vueData.form.GWCQ004);
                                        }
                                    }
                                }
                            });
                        }
                        //组合|非组合+裸价、特价
                        if (vueData.form.GWDC001 != null && (vueData.form.GWDC004 == "1" || vueData.form.GWDC004 == "2") && vueData.form.GWDC005 != "3" && vueData.form.GWDC005 != "4") {
                            vueData.form.GWCQ003 = value;
                            vueData.form.GWCQ005 = math.mul(value, vueData.form.GWCQ004);
                            // var GWDC020 = 0,
                            //     GWDC021 = 0;
                            // var _xData = {};
                            // if (vueData.form.GWDC004 == "1") {
                            //     _xData = {GWCS109: vueData.form.GWDC001, GWCS010: vueData.form.GWAK001};
                            // } else {
                            //     _xData = {
                            //         GWCS109: vueData.form.GWDC001,
                            //         GWCS001: vueData.form.GWAM001,
                            //         GWCS010: vueData.form.GWAK001
                            //     }
                            // }
                            // if (vueData.form.GWDC004 == "2") {
                            //     _xData.GWDC005 = vueData.form.GWDC004;
                            // }
                            // app.ajax({
                            //     xurl: 'crm/gwai710/getGwdc020_021',
                            //     xdata: _xData,
                            //     async: false,
                            //     cb: function (rt) {
                            //         if (rt.ok) {
                            //             GWDC020 = rt.data.data.GWDC020;
                            //             GWDC021 = rt.data.data.GWDC021;
                            //             var GWCS003 = 0;
                            //             if (vueData.form.GWDC004 == "1") {//组合
                            //                 GWCS003 = math.add(GWCS003, value);
                            //             } else {
                            //                 if (rt.data.data.GWDC022 == "Y") {//阶梯定价
                            //                     _xData.GWCS003 = value;
                            //                     _xData.GWCS001 = vueData.form.GWAM001;
                            //                     _xData.GWCS010 = vueData.form.GWAK001;
                            //                     _xData.GWCSDOCDATE = date.Format('yyyy-MM-dd');
                            //                     app.ajax({
                            //                         xurl: 'crm/gwai710/getGwdc020_021_jieti',
                            //                         xdata: _xData,
                            //                         async: false,
                            //                         cb: function (rtt) {
                            //                             if ((rtt.data.data.GWDC024 != null || rtt.data.data.GWDC024 != "") && rtt.data.data != "") {
                            //                                 vueData.form.GWCQ004 = rtt.data.data.GWDC024;
                            //                                 vueData.form.GWCQ005 = math.mul(value, vueData.form.GWCQ004);
                            //                             } else {
                            //                                 vueData.form.GWCQ004 = vueData.form.GWCQ113;
                            //                                 vueData.form.GWCQ005 = math.mul(value, vueData.form.GWCQ004);
                            //                             }
                            //                         }
                            //                     });
                            //                 }
                            //                 GWCS003 = value;
                            //             }
                            //             if (GWCS003 < GWDC020) {
                            //                 app.confirm({
                            //                     msg: '修改数量导致不满足促销活动，是否确定修改？',
                            //                     ok: function () {
                            //                         vueData.form.GWCQ003 = value;
                            //                         vueData.form.GWCQ109 = '';
                            //                         vueData.form.GWCQ110 = '';
                            //                         vueData.form.GWCQ111 = '';
                            //                         vueData.form.GWCQ004 = vueData.form.GWCQ113;
                            //                         vueData.form.GWCQ005 = math.mul(value, vueData.form.GWCQ004);
                            //                     },
                            //                     cancel: function () {
                            //                         value = vueData.form.GWCQ003;
                            //                     }
                            //                 });
                            //             } else {
                            //             }
                            //         }
                            //     }
                            // });

                        }
                    },
                    cancel: function () {
                        layer.close(callObj.layOpenIndex);
                    },
                    saveData: function () {
                        var flag = true;
                        //组合+满量
                        // if (vueData.form.GWDC005 == "4" && vueData.form.GWDC004 == "1") {
                        //     app.ajax({
                        //         xurl: 'crm/gwai710/getGwcsz005_006',
                        //         xdata: {
                        //             GWCS109: vueData.form.GWDC001,
                        //             GWCSDOCNO: '',
                        //             GWCS010: vueData.form.GWAK001,
                        //             sum_gwcs003: vueData.form.GWCQ003
                        //         },
                        //         async: false,
                        //         cb: function (result) {
                        //             if (result.ok) {
                        //                 var GWDC020 = 0, GWDC021 = 0, GWDC025 = 0, GWDC026 = 0;
                        //                 //首先判断订单单身是否满足起订数量
                        //                 if (vueData.form.GWCQ003 < result.data.data.GWDC020) {
                        //                     var msg = '数量不满足活动起订数量：' + result.data.data.GWDC020;
                        //                     app.showWarning(msg);
                        //                     flag = false;
                        //                     return;
                        //                 }
                        //             }
                        //         }
                        //     });
                        // }
                        // //组合+满额
                        // if (vueData.form.GWDC005 == "3" && vueData.form.GWDC004 == "1") {
                        //     app.ajax({
                        //         xurl: 'crm/gwai710/getGwcsz005_006',
                        //         xdata: {
                        //             GWCS109: vueData.form.GWDC001,
                        //             GWCSDOCNO: '',
                        //             GWCS010: vueData.form.GWAK001,
                        //             sum_gwcs005: vueData.form.GWCQ005
                        //         },
                        //         async: false,
                        //         cb: function (result) {
                        //             if (result.ok) {
                        //                 //首先判断单身是否满足起订金额
                        //                 if (vueData.form.GWCQ005 < result.data.data.GWDC021) {
                        //                     var msg = '金额不满足活动起订金额：' + result.data.data.GWDC021;
                        //                     app.showWarning(msg);
                        //                     flag = false;
                        //                     return;
                        //                 }
                        //
                        //             }
                        //         }
                        //     });
                        // }
                        //非组合+满量
                        if (vueData.form.GWDC005 == "4" && vueData.form.GWDC004 == "2") {
                            var _yData = {
                                GWCSDOCDATE: new Date().Format('yyyy-MM-dd'),
                                GWCS010: vueData.form.GWAK001,
                                GWCS001: vueData.form.GWAM001,
                                GWCS109: vueData.form.GWDC001,
                                GWCS003: vueData.form.GWCQ003
                            };
                            app.ajax({
                                xurl: 'admin/getPriceSingel',
                                xdata: _yData,
                                async: false,
                                cb: function (rtt) {
                                    if (rtt.ok) {
                                        if ((rtt.data.data.GWDC024 != null || rtt.data.data.GWDC024 != "") && rtt.data.data != "") {
                                            vueData.form.GWCQ004 = rtt.data.data.GWDC024;
                                        } else {
                                            app.ajax({
                                                xurl: 'admin/getGwcsz005_006',
                                                xdata: {
                                                    GWCS109: vueData.form.GWDC001,
                                                    GWCSDOCNO: '',
                                                    GWCS001: vueData.form.GWAM001,
                                                    GWCS010: vueData.form.GWAK001,
                                                    sum_gwcs003: vueData.form.GWCQ003
                                                },
                                                async: false,
                                                cb: function (result) {
                                                    if (result.ok) {
                                                        //首先判断订单单身是否满足起订数量
                                                        if (vueData.form.GWCQ003 < result.data.data.GWDC020) {
                                                            var msg = '活动编号：' + vueData.form.GWDC001 + '产品：' + vueData.form.GWAM001 + ',数量不满足活动起订数量：' + result.data.data.GWDC020;
                                                            app.showWarning(msg);
                                                            flag = false;
                                                            return;
                                                        }
                                                    }
                                                }
                                            });
                                        }
                                    }
                                }
                            });
                        }
                        //非组合+满额
                        if (vueData.form.GWDC005 == "3" && vueData.form.GWDC004 == "2") {
                            var _yData = {
                                GWCSDOCDATE: new Date().Format('yyyy-MM-dd'),
                                GWCS010: vueData.form.GWAK001,
                                GWCS001: vueData.form.GWAM001,
                                GWCS109: vueData.form.GWDC001,
                                GWCS003: vueData.form.GWCQ003,
                                GWCS115: vueData.form.GWCQ004 //结算价
                            };
                            app.ajax({
                                xurl: 'admin/getPriceSingel',
                                xdata: _yData,
                                async: false,
                                cb: function (rtt) {
                                    if (rtt.ok) {
                                        if ((rtt.data.data.GWDC024 != null || rtt.data.data.GWDC024 != "") && rtt.data.data != "") {
                                            vueData.form.GWCQ004 = rtt.data.data.GWDC024;
                                        } else {
                                            app.ajax({
                                                xurl: 'admin/getGwcsz005_006',
                                                xdata: {
                                                    GWCS109: vueData.form.GWDC001,
                                                    GWCSDOCNO: '',
                                                    GWCS001: vueData.form.GWAM001,
                                                    GWCS010: vueData.form.GWAK001,
                                                    sum_gwcs005: vueData.form.GWCQ005
                                                },
                                                async: false,
                                                cb: function (result) {
                                                    if (result.ok) {
                                                        //首先判断单身是否满足起订金额
                                                        if (vueData.form.GWCQ005 < result.data.data.GWDC021) {
                                                            var msg = '活动编号：' + vueData.form.GWDC001 + '产品：' + vueData.form.GWAM001 + ',金额不满足活动起订金额：' + result.data.data.GWDC021;
                                                            app.showWarning(msg);
                                                            flag = false;
                                                            return;
                                                        }
                                                    }
                                                }
                                            });
                                        }
                                    }
                                }
                            });
                        }

                        //组合+裸价
                        // if (vueData.form.GWDC005 == "1" && vueData.form.GWDC004 == "1") {
                        //     app.ajax({
                        //         xurl: 'crm/gwai710/getGwdc020_021',
                        //         xdata: {
                        //             GWCS109: vueData.form.GWDC001,
                        //             GWCS010: vueData.form.GWAK001,
                        //             sum_gwcs005: vueData.form.GWCQ005
                        //         },
                        //         async: false,
                        //         cb: function (result) {
                        //             if (result.ok) {
                        //                 //首先判断单身是否满足起订金额
                        //                 if (vueData.form.GWCQ005 < result.data.data.GWDC021) {
                        //                     var msg = '组合活动编号:' + vueData.form.GWDC001 + ',总金额不满足活动起订金额：' + result.data.data.GWDC021;
                        //                     app.showWarning(msg);
                        //                     flag = false;
                        //                     return;
                        //                 }
                        //             }
                        //         }
                        //     });
                        // }
                        //非组合+裸价
                        // if (vueData.form.GWDC005 == "1" && vueData.form.GWDC004 == "2") {
                        //     app.ajax({
                        //         xurl: 'admin/getGwdc020_021',
                        //         xdata: {
                        //             GWCS109: vueData.form.GWDC001,
                        //             GWCS010: vueData.form.GWAK001,
                        //             GWCS001: vueData.form.GWAM001,
                        //             sum_gwcs005: vueData.form.GWCQ005
                        //         },
                        //         async: false,
                        //         cb: function (result) {
                        //             if (result.ok) {
                        //                 //首先判断单身是否满足起订金额
                        //                 if (vueData.form.GWCQ005 < result.data.data.GWDC021) {
                        //                     var msg = '非组合活动编号:' + vueData.form.GWDC001 + ',产品编号:' + vueData.form.GWAM001 + ',总金额不满足活动起订金额：' + result.data.data.GWDC021;
                        //                     app.showWarning(msg);
                        //                     flag = false;
                        //                     return;
                        //                 }
                        //             }
                        //         }
                        //     });
                        // }
                        if (vueData.form.GWDC004 == "2" && vueData.form.GWDC005 != "3" && vueData.form.GWDC005 != "4") {
                            var GWDC020 = 0,
                                GWDC021 = 0;
                            var _xData = {};
                            if (vueData.form.GWDC004 == "1") {
                                _xData = {GWCS109: obj.data.GWDC001, GWCS010: vueData.form.GWAK001};
                            } else {
                                _xData = {
                                    GWCS109: vueData.form.GWDC001,
                                    GWCS001: vueData.form.GWAM001,
                                    GWCS010: vueData.form.GWAK001
                                }
                            }
                            if (vueData.form.GWDC005 == "2") {
                                _xData.GWDC005 = vueData.form.GWDC005;
                            }
                            app.ajax({
                                xurl: 'admin/getGwdc020_021',
                                xdata: _xData,
                                async: false,
                                cb: function (rt) {
                                    if (rt.ok) {
                                        GWDC020 = rt.data.data.GWDC020;
                                        GWDC021 = rt.data.data.GWDC021;
                                        var GWCS003 = 0;
                                        if (vueData.form.GWDC004 == "1") {//组合
                                            GWCS003 = vueData.form.GWCQ003;
                                            // if(GWCS003 < GWDC020) {
                                            //     var msg = '非组合活动编号:' + vueData.form.GWDC001 + ',产品编号:' + vueData.form.GWAM001 + ',总数量不满足活动起订数量：' + GWDC020;
                                            //     app.showWarning(msg);
                                            //     flag = false;
                                            //     return;
                                            // }
                                        } else {
                                            if (rt.data.data.GWDC022 == "Y") {//阶梯定价
                                                _xData.GWCS003 = vueData.form.GWCQ003;
                                                _xData.GWCS001 = vueData.form.GWAM001;
                                                _xData.GWCS010 = vueData.form.GWAK001;
                                                _xData.GWCSDOCDATE = new Date().Format('yyyy-MM-dd');
                                                app.ajax({
                                                    xurl: 'crm/gwai710/getGwdc020_021_jieti',
                                                    xdata: _xData,
                                                    async: false,
                                                    cb: function (rtt) {
                                                        if ((rtt.data.data.GWDC024 != null || rtt.data.data.GWDC024 != "") && rtt.data.data != "") {
                                                            vueData.form.GWCQ004 = rtt.data.data.GWDC024;
                                                        } else {
                                                            var msg = '非组合活动编号:' + vueData.form.GWDC001 + ',产品编号:' + vueData.form.GWAM001 + ',总数量不满足活动起订数量：' + GWDC020;
                                                            app.showWarning(msg);
                                                            flag = false;
                                                            return;
                                                        }
                                                    }
                                                });
                                            }
                                            GWCS003 = vueData.form.GWCQ003;
                                        }
                                        if (GWCS003 < GWDC020) {
                                            var msg = '非组合活动编号:' + vueData.form.GWDC001 + ',产品编号:' + vueData.form.GWAM001 + ',总数量不满足活动起订数量：' + GWDC020;
                                            app.showWarning(msg);
                                            flag = false;
                                            return;
                                        }
                                    }
                                }
                            });

                        }
                        if (!flag) {
                            return;
                        }
                        if (flag) {
                            vueData.form.GWCQ001 = vueData.form.GWAM001;
                            //vueData.form.GWCQ002 = vueData.form.GWAM008;
                            vueData.form.GWCQ005 = math.mul(vueData.form.GWCQ003, vueData.form.GWCQ004);
                            vueData.form.GWCQ010 = vueData.form.GWAK001;
                            if (vueData.form.GWDC001 != '' && vueData.form.GWDC001 != null) {
                                vueData.form.GWCQ109 = vueData.form.GWDC001;
                                vueData.form.GWCQ110 = vueData.form.GWDC005;
                                vueData.form.GWCQ111 = vueData.form.GWDC004;
                            }
                            app.ajax({
                                xurl: 'admin/saveData',
                                xdata: vueData.form,
                                okmsg: '添加购物车成功',
                                cb: function (result) {
                                    if (result.ok) {
                                        self._closeTpl();
                                    }
                                }
                            });
                        }
                    },
                    smallImg: function () {

                        //$.fancybox.open(jetZoom.getGalleryList()); // and pass Jet Zoom's image list to Fancy Box.

                        $('[data-fancybox]').fancybox({
                            protect: true,
                            buttons: [
                                "zoom", "slideShow", "thumbs", "close"
                            ],
                            thumbs: {
                                autoStart: true,//在打开时显示缩略图
                                //hideOnClose:true,//关闭动画时隐藏缩略图网格
                                parentEl: '.cloud-zoom-gallery',//将Container注入此元素
                                axis: 'y'//垂直（y）或水平（x）滚动
                            }
                        });


                    }
                },
                watch: {},
                created: function () {
                    self._setEleIsReady('goods-info');
                },
                updated: function () {

                    $('.cloud-zoom, .cloud-zoom-gallery').CloudZoom();
                    $('#slider1').Thumbelina({
                        $bwdBut: $('#slider1 .left'),
                        $fwdBut: $('#slider1 .right')
                    })


                }
            });
            //图片放大预览
            // function zoolImg() {
            //     var objDemo = document.getElementById("demo");
            //     var objSmallBox = document.getElementById("small-box");
            //     var objMark = document.getElementById("mark");
            //     var objFloatBox = document.getElementById("float-box");
            //     var objBigBox = document.getElementById("big-box");
            //     var objBigBoxImage = objBigBox.getElementsByTagName("img")[0];
            //     //鼠标一如事件
            //     objMark.onmouseover = function () {
            //         objFloatBox.style.display = "block"
            //         objBigBox.style.display = "block"
            //     }
            //     //鼠标移出事件
            //     objMark.onmouseout = function () {
            //         objFloatBox.style.display = "none"
            //         objBigBox.style.display = "none"
            //     }
            //     //鼠标移动事件
            //     objMark.onmousemove = function (ev) {
            //         var _event = ev || window.event;  //兼容多个浏览器的event参数模式
            //
            //         var left = _event.clientX - objDemo.offsetLeft - objSmallBox.offsetLeft - objFloatBox.offsetWidth / 2;
            //         var top = _event.clientY - objDemo.offsetTop - objSmallBox.offsetTop - objFloatBox.offsetHeight / 2;
            //         if (left < 0) {
            //             left = 0;
            //         } else if (left > (objMark.offsetWidth - objFloatBox.offsetWidth)) {
            //             left = objMark.offsetWidth - objFloatBox.offsetWidth;
            //         }
            //         if (top < 0) {
            //             top = 0;
            //         } else if (top > (objMark.offsetHeight - objFloatBox.offsetHeight)) {
            //             top = objMark.offsetHeight - objFloatBox.offsetHeight;
            //         }
            //         objFloatBox.style.left = left + "px";
            //         objFloatBox.style.top = top + "px";
            //         var percentX = left / (objMark.offsetWidth - objFloatBox.offsetWidth);
            //         var percentY = top / (objMark.offsetHeight - objFloatBox.offsetHeight);
            //         objBigBoxImage.style.left = -percentX * (objBigBoxImage.offsetWidth - objBigBox.offsetWidth) + "px";
            //         objBigBoxImage.style.top = -percentY * (objBigBoxImage.offsetHeight - objBigBox.offsetHeight) + "px";
            //     }
            // }
            // zoolImg();

        },
        _lazy: function () {
            this._super();
        }
    });

    return new goodsInfo();

});